#pragma once

#include <string>
#include <vector>

#include <QObject>
#include <qstring.h>
#include <qvector.h>
#include <qdatetime.h>
#include <QtSql/qsqldatabase.h>
#include <QtSql/qsqlquery.h>
#include <QtSql/qsqlerror.h>
#include <qmetatype.h>

class database_operations  : public QObject
{
	Q_OBJECT

public:
	static database_operations* getInstance();
	static void deleteInstance();

	

	bool isOpen();
	/*bool insert_record(std::string table_name, std::string type, std::vector<float>values);
	bool select_record(std::string table_name, std::string type, int num, float* values);*/

	bool insert_dataset_record(std::string table_name, std::string dataset_name, std::string dataset_path, int dataset_type, std::string annot_path);
	//bool select_dataset_record(std::string table_name, std::string dataset_path, int dataset_type, std::string annot_path);
	bool select_dataset_record(std::string table_name, std::string cmd, QVector<QString>& dataset_names, QVector<QString>&datasets_path, QVector<int>&types, QVector<QString>&annots_path);
	bool delete_dataset_record(QString table_name, QString dataset_name);
	QString dataset_path_table = "dataset_path_table";
	std::vector<std::string>table_names;

private:
	database_operations(QObject* parent = nullptr);
	~database_operations();

	QSqlDatabase DB;
	std::string database_name = "dataset_database.db";

	//std::vector<int>points;
	std::vector<std::string>select_datasets;
	static database_operations* database_ptr;

};
